<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../includes/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<div class="nav-menu">

	<ul>
		<%
			List<MenuItem> menus = (List<MenuItem>) request.getAttribute("navigationMenus");
			int counter = 0;
		%>
		<c:forEach var="menu" items="${navigationMenus}" varStatus="status">
			<%
				String menuCssClass = "main-item";
					if (counter == 0) {
						menuCssClass = menuCssClass + " first-item";
					}

					if ((counter + 1) >= menus.size()) {
						menuCssClass = menuCssClass + " last-item";
					}
			%>
			<c:if test="${menu.selected}">
				<%
					menuCssClass = menuCssClass + " selected";
				%>
			</c:if>


			<li class="<%=menuCssClass%>"><a class="main-item-link"
				href="${pageContext.request.contextPath}${menu.URL}">${menu.name}</a>
				<c:if test="${menu.hasChildren}">
					<ul class="child-menu">
						<c:forEach var="child" items="${menu.children}"
							varStatus="childStatus">
							<%
								String childMenuCssClass = "";
							%>
							<c:if test="${child.selected}">
								<%
									childMenuCssClass = childMenuCssClass + " selected";
								%>
							</c:if>

							<li class="<%=childMenuCssClass%>"><a
								href="${pageContext.request.contextPath}${child.URL}">${child.name}</a>
							</li>
						</c:forEach>
					</ul>
				</c:if></li>
			<%
				counter++;
			%>
		</c:forEach>
	</ul>
</div>


